import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routesInner = [
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/HomeView.vue"),
  },
  {
    path: "/saoLei",
    name: "saoLei",
    component: () => import("@/lab45/SaoLei"),
  },

  {
    path: "/about/abc/def",
    name: "about",
    component: () => import("@/views/AboutView.vue"),
  },
  {
    path: "/testOne",
    name: "testOne",
    component: () => import("@/views/TestOne.vue"),
  },
  {
    path: "/testTwo",
    name: "testTwo",
    component: () => import("@/views/TestTwo.vue"),
  },
  {
    path: "/testThree",
    name: "testThree",
    component: () => import("@/views/TestThree.vue"),
  },
  {
    path: "/testFour",
    name: "testFour",
    component: () => import("@/views/TestFour.vue"),
  },
  {
    path: "/testFive",
    name: "testFive",
    component: () => import("@/views/TestFive.vue"),
  },
  {
    path: "/testSix",
    name: "testSix",
    component: () => import("@/views/TestSix"),
    children: [
      {
        path: "/firstPage",
        name: "firstPage",
        component: () => import("@/views/six/FirstPage.vue"),
      },
      {
        path: "/secondPage",
        name: "secondPage",
        component: () => import("@/views/six/SecondPage.vue"),
      },
      // /testSix/thirdPage
      {
        // path: "/testSix/thirdPage",
        path: "thirdPage",
        name: "thirdPage",
        component: () => import("@/views/six/ThirdPage.vue"),
      },
    ],
  },
  {
    path: "/testForm",
    name: "testForm",
    component: () => import("@/views/TestForm.vue"),
  },
  {
    path: "/testDrawer",
    name: "testDrawer",
    component: () => import("@/views/TestDrawer.vue"),
  },
  {
    path: "/testAxios",
    name: "testAxios",
    component: () => import("@/views/TestAxios.vue"),
  },
  {
    path: "/finalPlayer",
    name: "finalPlayer",
    component: () => import("@/views/FinalPlayer.vue"),
  },
  {
    path: "/echartsTest",
    name: "echartsTest",
    component: () => import("@/views/EchartsTest.vue"),
  },
];

const routes = [
  {
    path: "/",
    name: "",
    redirect: "/logon",
  },
  {
    path: "/logon",
    name: "logon",
    component: () => import("@/viewy/Logon.vue"),
  },
  {
    path: "/content",
    name: "/content",
    component: () => import("@/viewy/Content.vue"),
    children: routesInner,
  },
];
const router = new VueRouter({
  routes,
});
//拦截器 路由拦截器 钩子函数 导航守卫 guard
router.beforeEach((to, from, next) => {
  // console.log("============");
  // console.log(to);
  // console.log(from);
  console.log("============");
  next();
});
// router.addRoutes()

export default router;
